package cc.jt.rl;

import java.util.HashMap;
import java.util.Map;

public class RateLimiterConfig {

  private final Map<String, Integer> resourceLimiter = new HashMap<>();

  public void clear() {
    resourceLimiter.clear();
  }

  public RateLimiterConfig set(String resource, int count) {
    if (count < 0) {
      throw new IllegalArgumentException("count must not lt 0");
    }
    resourceLimiter.put(resource, count);
    return this;
  }

  public Integer get(String resource) {
    return resourceLimiter.get(resource);
  }
}
